/**
 * 项目通用折线图
 * X轴为category，Y轴value
 */
function line(dataJson,color) {
    var seriesType = []
    //第一行legend标签数据
    var category = dataJson[0]
    for (var i = 1; i < category.length; i++) {
        seriesType.push({
            type: 'line',
            // 设置item显示数值
            // label: {
            //     show: true,
            //     position: 'outside',
            //     fontSize: 10,
            //     color: '#fff',
            //     formatter: '{@[' + i + ']}' + '%',
            // },

        })
    }

    option = {
        legend: {
//            type: 'scroll',
            formatter: commonLegendFormatter(name,category),
            itemWidth: 8,
            itemHeight: 2,
            // formatter: "{name}".join("\n"),
            textStyle: {
                color: color,
                fontSize: 10,
            },
            padding: [0, 1],
            icon: 'roundRect',
        },
        tooltip: commonTooltip,
        dataset: {
            source: dataJson
        },
        xAxis: commonXAxis(color),
        yAxis: commonYAxis(color),
        grid: commonGrid(category),
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: seriesType
    };

    return option
}

/**
 * 项目通用折线图
 * X轴为category，Y轴value
 */
function fillLine(dataJson,color) {
    var seriesType = []
    //第一行legend标签数据
    var category = dataJson[0]
    for (var i = 1; i < category.length; i++) {
        seriesType.push({
            type: 'line',
//            stack: 'value',
            smooth: true,
             areaStyle: {
                    opacity: 0.8,
                    }
//             showSymbol: false,
            // 设置item显示数值
            // label: {
            //     show: true,
            //     position: 'outside',
            //     fontSize: 10,
            //     color: '#fff',
            //     formatter: '{@[' + i + ']}' + '%',
            // },

        })
    }

    option = {
        legend: {
            // type: 'scroll',
            formatter: commonLegendFormatter(name,category),
            itemWidth: 8,
            itemHeight: 2,
            // formatter: "{name}".join("\n"),
            textStyle: {
                color: color,
                fontSize: 10,
            },
            padding: [0, 1],
            icon: 'roundRect',
        },

        tooltip: commonTooltip,
        dataset: {
            source: dataJson
        },
        xAxis: commonXAxis(color),
        yAxis: commonYAxis(color),
        grid: commonGrid(category),
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: seriesType
    };

    return option
}

/**
 * 项目通用折线图
 * X轴为category，Y轴value
 */
function stackLine(dataJson,color) {
    var seriesType = []
    //第一行legend标签数据
    var category = dataJson[0]
    for (var i = 1; i < category.length; i++) {
        seriesType.push({
            type: 'line',
            stack: 'value',
            smooth: true,
             areaStyle: {
                    opacity: 0.8,
                    }
//             showSymbol: false,
            // 设置item显示数值
            // label: {
            //     show: true,
            //     position: 'outside',
            //     fontSize: 10,
            //     color: '#fff',
            //     formatter: '{@[' + i + ']}' + '%',
            // },

        })
    }

    option = {
        legend: {
            // type: 'scroll',
            itemWidth: 8,
            itemHeight: 2,
            // formatter: "{name}".join("\n"),
            textStyle: {
                color: color,
                fontSize: 10,
            },
            padding: [0, 1],
            icon: 'roundRect',
        },
        tooltip: commonTooltip,
        dataset: {
            source: dataJson
        },
        xAxis: commonXAxis(color),
        yAxis: commonYAxis(color),
        grid: commonGrid(category),
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: seriesType
    };

    return option
}